package com.zhht.htzx.ui;

import static com.nsgf.library.ui.product.ProductDetailActivity.setUpWebView;

import android.os.Bundle;

import androidx.annotation.Nullable;

import com.kunminx.architecture.ui.page.DataBindingConfig;
import com.nsgf.library.data.bean.MessageBean;
import com.nsgf.library.ui.page.BaseActivity;
import com.nsgf.library.ui.page.StateHolder;
import com.zhht.htzx.BR;
import com.zhht.htzx.R;
import com.zhht.htzx.databinding.ActivityNoticesDetailsBinding;

import java.io.UnsupportedEncodingException;

public class NoticesDetailActivity extends BaseActivity {

    private StateHolder mStates;

    private ActivityNoticesDetailsBinding mBinding;

    @Override
    protected void initViewModel() {

        mStates = getActivityScopeViewModel(StateHolder.class);

    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {
        return new DataBindingConfig(R.layout.activity_notices_details, BR.vm, mStates);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mBinding = (ActivityNoticesDetailsBinding) getBinding();
        mStates.message.set(getIntent().getParcelableExtra("data"));
        mStates.titleBar.set("公告详情");

        try {
            setUpWebView(mBinding.webView.getWebView(), mStates.message.get().getContent());
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }

    }
}
